# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xf86-video-nouveau
pkgver=1.0.17
pkgrel=6
pkgdesc="Open-source X.org drivers for nVidia video cards"
url="https://nouveau.freedesktop.org/"
arch="all"
license="MIT"
depends="mesa-dri-gallium"
makedepends="libdrm-dev xorg-server-dev util-macros eudev-dev xorgproto"
subpackages="$pkgname-doc"
source="https://www.x.org/archive/individual/driver/xf86-video-nouveau-$pkgver.tar.bz2
	xorg-server-21.1.patch
	"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	export CFLAGS="${CFLAGS/-fno-plt} -DFB_ACCESS_WRAPPER"
	export CXXFLAGS="${CXXFLAGS/-fno-plt} -DFB_ACCESS_WRAPPER"
	export LDFLAGS="$LDFLAGS -Wl,-z,lazy"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
adba58ba5298d1a5b3f9f8540f9ef2cb2e10e47bba8e374103ec2e1f92e915f5f4393ed0021168cd649646e12315135a1efcdf77e8fb1648e1295914d87279b2  xf86-video-nouveau-1.0.17.tar.bz2
6c1bc0a2197a0fdaa3f669ce96ab2bc0167642168da01a86c712e1a77692244ad7b68a5c71d47b62abb6fa9b74f0495226133b7eff4badbd6dda56994bba74c8  xorg-server-21.1.patch
"
